package com.zkca.xf.ui.activity.me;


import android.os.Bundle;
import android.view.View;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.TextView;

import com.zkca.xf.Constants_SP;
import com.zkca.xf.R;
import com.zkca.xf.base.BaseTitleActivity;
import com.zkca.xf.model.javabean.UserId;
import com.zkca.xf.presenter.FeedbackPresenter;
import com.zkca.xf.utils.SPUtil;
import com.zkca.xf.utils.ToastUtils;
import com.zkca.xf.view.FeedbackView;

import java.util.HashMap;
import java.util.Map;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class FeedbackActivity extends BaseTitleActivity  implements FeedbackView {
    @BindView(R.id.et_content)
    EditText et_content;
    @BindView(R.id.ch_error)
    CheckBox ch_error;
    @BindView(R.id.cb_suggest)
    CheckBox cb_suggest;
    @BindView(R.id.cb_software)
    CheckBox cb_software;
    @BindView(R.id.tv_submit)
    TextView tv_submit;

    private FeedbackPresenter feedbackPresenter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_feedback);
        ButterKnife.bind(this);
        setTitleText("问题反馈");
        setleftTextVisibility(true);
        setleftImgVisibility(true);
        feedbackPresenter=new FeedbackPresenter(this,this);
    }



    @OnClick(R.id.tv_submit)
    public void onClick(View view){
        switch (view.getId()) {
            case R.id.tv_submit://提交
                String content = et_content.getText().toString();
//                boolean error = ch_error.isChecked();
//                boolean suggest = cb_suggest.isChecked();
//                boolean software = cb_software.isChecked();


                String user_id = SPUtil.getString(this,Constants_SP.USER_ID, "");
                Map<String, String> map = new HashMap<>();
                map.put("userId", user_id);
                map.put("content",content);

                feedbackPresenter.Feedback(map);

                ToastUtils.show(FeedbackActivity.this,"十分感谢您的建议，我们将尽快受理您的反馈！");
                break;
        }
    }

    @Override
    public void getFeedback(UserId userId) {

    }

    @Override
    public void showProgressDialog() {

    }

    @Override
    public void hideProgressDialog() {

    }

    @Override
    public void showError(String msg) {

    }
}
